<?php
    
    namespace App\Module\Api\Validator;
    use App\System\Base\Validator\BaseValidator;

    /**
     * 定义验证器类
     * @author liujun
     */
    class SmsCodeValidator extends BaseValidator
    {
        protected $rules = [
            'q.a' => 'required|integer|between:1,2',
            'q.type' => 'required|integer|between:1,7',
            'q.mobile' => 'required_if:q.type,1,q.type,2|regex:/^1[0-9]{10}$/',
            'q.code' => 'required_if:q.a,2|integer',
        ];
        
        protected $messages = [

        ];

        protected $attributes = [
            'q.a' => '请求类型',
            'q.type' => '发送类型',
            'q.mobile' => '手机号',
            'q.code' => '验证码'
        ];
    }